package com.coco.service.impl; 
import com.coco.service.TestService;
import com.coco.entity.Test; 
import com.coco.entity.Test; 
import java.util.List; 
import org.springframework.beans.factory.annotation.Autowired; 
import org.springframework.stereotype.Service; 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 
import com.coco.mapper.TestMapper; 

@Service 
public class TestServiceImpl implements TestService{ 
      private TestMapper testMapper; 

      @Autowired 
      public TestServiceImpl(TestMapper testMapper) { 
             this.testMapper = testMapper; 
} 



@Override 
      public List<Test> queryPage(Integer pageNo, Integer pageSize) { 
             Page<Test> page = testMapper.selectPage(new Page<>(pageNo, pageSize), new QueryWrapper<Test>()); 
             List<Test> recodes = page.getRecords(); 
             return recodes; 
} 


      @Override 
      public void add(Test test){ 
             testMapper.insert(test); 
} 


      @Override 
      public void edit(Test test){ 
             testMapper.updateById(test); 
} 


      @Override 
      public void delById(Integer id){ 
             testMapper.deleteById(id); 
} 


      @Override 
      public Test getById(Integer id) { 
              return testMapper.selectById(id); 
} 
} 
